package test;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class AServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String account = request.getParameter("account");
        String password = request.getParameter("password");
        System.out.println("A获取到："+account+"，"+password);
//
        //转发：携带数据过去
//        request.getRequestDispatcher("/b").forward(request,response);
   // 重定向：是不会携带数据的，因为是直接访问地址的 相当于控制的是浏览器
        response.sendRedirect("/b");
        int i=0;
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doPost(req, resp);
    }
}
